<?php if (defined("YTDJ") or die()); 

class Video extends Entity {
	
	var $id;
	var $updatedon;
	var $artist;
	var $title;
	var $duration;
	var $thumbnail;
	var $rating;
	
	/**
	 * Constructor
	 *
	 */
	function __construct($id, $meta = null) {
		$this->initDB("video", "id");
		$this->initEntity($this->id = $id);
		if (!$this->hasRecord() && isset($meta)) {
			$this->setArray($meta);
		}
	}
	
	function parseMetaArray(&$meta) {
		$meta["duration"] = gmdate("H:i:s", $meta["duration"]);
	}
	
	function setUpdated() {
		$db = &DB::getInstance();
		return $db->update_sql("UPDATE video SET updatedon = NOW() WHERE id = '$this->id'");
	}
	
}

?>